package cc.idoone.springframework.placeholder.controller;

import cc.idoone.springframework.placeholder.PlaceholderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther: hemj
 * @since: 2018/8/1
 */
@RestController
@RequestMapping("/placeholder")
public class PlaceholderController {
    @Value("${spring.str}")
    private String str;
    @Autowired
    @Qualifier("annoPlaceholderService")
    private PlaceholderService annoPlaceholderService;
    @Autowired
    @Qualifier("xmlPlaceholderService")
    private PlaceholderService xmlPlaceholderService;

    @RequestMapping("/demo")
    public String hello() {
        System.out.println("\nannoPlaceholderService");
        annoPlaceholderService.hello();
        System.out.println("\nxmlPlaceholderService");
        xmlPlaceholderService.hello();
        System.out.println("\nPlaceholderController");
        System.out.println("str=" + str);
        return "hello";
    }
}
